home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 5
/
The 640 Meg Shareware Studio CD-ROM Volume V (Data Express)(1994).ISO
/
amiga
/
tdemo2.lha
/
ProgrammersInfo
/
DSKEL-XS.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-05
|
7KB
|
254 lines
/*
DSKEL-XS v1.1
(Xpress User Stats DOOR)
1 2 3
(123456789012345678901234567890123456789)
Conf Access : XX_X____X___s__sX______X______________X
Caller Num. : 100888
1st Date On : 22 Apr 91
Lst Date On : 7 Mar 92
Security Lv : 255
# Times On : 1123 Today : 4
Msgs Posted : 1500 Today : 0
File Ratio : Disabled
Byte Ratio : Disabled
# Downloads : 71 Today : 0
# Uploads : 85 Today : 0
Bytes DL'd : 137936061 Today : 39994
Bytes UL'd : 8089329 Today : 4433
Online Baud : 14400
Screen Clear: On
Time Bar : Off
Bytes Avail : 3000000
*/
//**********************
//***** Includes *****
//**********************
#include <proto/all.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdarg.h>
#include <string.h>
#include <tempest/headers.h>
//********************************
//***** Structures/Defines *****
//********************************
int DoorStart(TEXT *);
VOID GetStr(TEXT *,int);
VOID pl(TEXT *,...);
int DOORIO(VOID);
VOID CloseStuff(VOID);
struct MyMessage
{
struct Message Msg; // for Exec message routines
ULONG Command; // Command to be executed.
char *text1,
*text2,
*text3;
int Value1,
Value2;
ULONG LongValue;
LONGBITS Flags;
int carrier;
struct User *User; // Pointers!
struct SystemData *SystemData;
struct NodeData *NodeData;
struct Today *Today;
};
struct MsgPort *MyPort = NULL;
struct MyMessage *msg;
struct MyMessage send;
struct User *User;
char MyName[60],st[60];
//******************
//***** Main *****
//******************
main(int argc,char *argv[])
{
char string[200],string1[200];
char Day[5],Month[5],Year[5];
register int x=1;
if(!DoorStart(argv[1])) { PutStr("DSKEL-XS v3.15 [Xpress Stats]\n"); exit(0); }
strcpy(string,User->MsgBase);
do
{
if(string[x] == 'N') string[x] = '_';
else if(string[x] == 'S') string[x] = 's';
else string[x] = 'X';
x++;
}
while(x < 40);
strmid(string,string1,2,39);
pl("\f\r\n
1 2 3\r\n");
pl("
(
123456789012345678901234567890123456789
)\r\n");
pl("Conf Access : %s\r\n",string1);
//********************************************************************
GetStr(string1,95);
pl("
Caller Num. :
%s\r\n",string1);
//********************************************************************
strcpy(string,ctime(&User->Time_First_Called));
strmid(string,Month,5,3);
strmid(string,Day,9,2);
strmid(string,Year,23,2);
pl("
1st Date On :
%2s %s %s\r\n",Day,Month,Year);
//********************************************************************
strcpy(string,ctime(&User->Time_Last_Logoff));
strmid(string,Month,5,3);
strmid(string,Day,9,2);
strmid(string,Year,23,2);
pl("
Lst Date On :
%2s %s %s\r\n",Day,Month,Year);
//********************************************************************
pl("
Security Lv :
%d\r\n",User->Security);
//********************************************************************
pl("
# Times On :
%-5d
Today :
%d\r\n",User->Total_Calls,User->Period_Calls);
//********************************************************************
pl("
Msgs Posted :
%-5d
Today :
%d\r\n",User->Total_Posts,User->Period_Posts);
//********************************************************************
if(User->F_Ratio==0) strcpy(string1,"Disabled");
else sprintf(string1,"%d/1",User->B_Ratio);
pl("
File Ratio :
%s\r\n",string1);
//********************************************************************
if(User->B_Ratio==0) strcpy(string1,"Disabled");
else sprintf(string1,"%d/1",User->B_Ratio);
pl("
Byte Ratio :
%s\r\n",string1);
//********************************************************************
pl("
# Downloads :
%-4d
Today :
%d\r\n",User->Total_DLFiles,User->Period_DLFiles);
//********************************************************************
pl("
# Uploads :
%-4d
Today :
%d\r\n",User->Total_ULFiles,User->Period_ULFiles);
//********************************************************************
pl("
Bytes DL'd :
%-10ld
Today :
%ld \r\n",User->Total_DLBytes,User->Period_DLBytes);
//********************************************************************
pl("
Bytes UL'd :
%-10ld
Today :
%ld\r\n",User->Total_ULBytes,User->Period_ULBytes);
//********************************************************************
GetStr(string1,19);
pl("
Online Baud :
%s\r\n",string1);
//********************************************************************
if(User->UserBitsA & 0x00000400L) strcpy(string1,"On");
else strcpy(string1,"Off");
pl("
Screen Clear:
%s\r\n",string1);
//********************************************************************
if(User->UserBitsA&0x00000008L) strcpy(string1,"On");
else strcpy(string1,"Off");
pl("
Time Bar :
%s\r\n",string1);
//********************************************************************
pl("
Bytes Avail :
%ld\r\n\r\n",User->Left_DLBytes);
//********************************************************************
CloseStuff();
}
//********************
//***** DoorIO ***** // MUST BE INCLUDED IN ALL DOORS!
//********************
int DOORIO(VOID)
{
struct MsgPort *HisPort;
if(send.carrier) return(0);
HisPort = FindPort(st);
if(HisPort!=NULL)
{
send.Msg.mn_Node.ln_Type = NT_MESSAGE;
send.Msg.mn_Length = sizeof(send);
send.Msg.mn_ReplyPort = MyPort;
send.carrier=0;
PutMsg((struct MsgPort *)HisPort,(struct Message *)&send);
Wait(1 << MyPort->mp_SigBit);
GetMsg(MyPort);
if(send.carrier) CloseStuff();
return(1);
}
return(0);
}
//************************
//***** Door Start *****
//************************
int DoorStart(TEXT *node)
{
struct MsgPort *HisPort;
send.carrier=0;
sprintf(st,"%s:TEMPEST_DOOR",node);
HisPort = FindPort(st);
if(HisPort==NULL) return (FALSE);
sprintf(MyName,"%s:DOOR_PORT",node);
MyPort = CreatePort(MyName,0L);
if(MyPort==NULL)
{
PutStr("Cant open port");
return(int)FALSE;
}
DOORIO();
User=*&send.User;
return (int)TRUE;
}
//*************************
//***** Close Stuff ***** // MUST BE INCLUDED IN ALL DOORS!
//*************************
VOID CloseStuff(VOID)
{
send.Command=999;
DOORIO();
while(msg=(struct MyMessage *)GetMsg(MyPort)) ReplyMsg((struct Message *)msg);
if(MyPort) DeletePort(MyPort);
exit(0);
}
//*********************************
//***** GetStr (Get String) ***** // Command 33
//*********************************
VOID GetStr(TEXT *s,int opt)
{
send.Command=33;
send.Value1=opt;
strcpy(s,NULL);
send.text1=s;
DOORIO();
}
//*****************************
//***** PL (Print Line) *****
//*****************************
VOID pl(TEXT *fmt,...)
{
va_list args;
char s[255];
va_start(args,fmt);
vsprintf(s,fmt,args);
va_end(args);
send.Command=1;
send.text1=&s[0];
DOORIO();
}